class Solution {
public:
    bool judgeSquareSum(int c)
    {
        unordered_map<int, int> hash;
        for (int i = 0; i <= sqrt(c); i++)
            hash[i * i]++;
        for (int i = 0; i <= sqrt(c); i++)
            if (hash.contains(c - i * i))
                return true;
        return false;
    }
};